package com.matt.foundation.vo;

import lombok.Data;
import com.matt.domain.teaching.TeachingPlan;
import com.matt.foundation.utils.DateUtil;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/7/11
 * *******************************
 */
@Data
public class PlanListVo {

    private Long id;

    private Integer month;

    private Integer day;

    private String fromTime;

    private String toTime;

    private Long materialId;

    private String materialUrl;

    private String materialTitle;

    public static PlanListVo of(TeachingPlan plan, String serverUrl, String ticket){
        PlanListVo vo = new PlanListVo();
        vo.setId(plan.getId());
        vo.setMonth(plan.getMonth());
        vo.setDay(plan.getDay());
        vo.setFromTime(DateUtil.millisToDateTime(plan.getFromTime().getTime(), "HH:mm"));
        vo.setToTime(DateUtil.millisToDateTime(plan.getToTime().getTime(), "HH:mm"));
        vo.setMaterialId(plan.getMaterialId());
       // vo.setMaterialUrl(String.format("%s/schemeDetail/%s/%s", serverUrl, ticket, plan.getMaterialId()));
        vo.setMaterialUrl(null);
        vo.setMaterialTitle(plan.getMaterialTitle());
        return vo;
    }
}
